<div class="row">
	<div class="span8" style="margin-top:10px; margin-left:100px;"><input type="button" class="span2 btn btn-primary" value="返回" onclick="history.back()" ></div>
    <div class="alert span8" style="margin-top:10px; margin-left:100px;">
      <strong>说明：</strong> 此功能用于将已有的孩子并入另一个家长的账号下的操作。（一个家长多孩子的处理）
    </div>
   
   <div class="span8" style="margin-left:100px;"> 
      <form action="/<*$controller*>/<*$action*>" method="get" class="form-horizontal">       
		<input  type="text" name="studentname" class="span3"  placeholder="输入预合并的孩子名称,逗号隔开" value="<*$studentname*>" /> 		<input  type="text" name="mobile" class="span2"  placeholder="输入一个孩子家长手机号" value="<*$mobile*>" />
        <input type="submit" class="btn btn-success"  value="开始查询"  >
         <input type="button" class="btn" value="重新查询" onclick="window.location='/<*$controller*>/<*$action*>'" >
         
      </form>
	</div>	 
    
<*if count($result)==1*>
<div class="alert alert-error span7"  style="margin-top:20px; margin-left:100px;">
  <strong>警告：</strong> 仅搜索出一个家长，不能进行合并操作
</div>
<*/if*>
<*if $result*>
<div class="span7">
    <ul class="unstyled clearfix">
   <*foreach from=$result item=item key=key name=foo*>
         <li class="white-panel span7">
<div class="white-panel-content">
	<div class="row-fluid">
    <div class="span4">
         <p> <strong><i class="icon-home"></i> <*$item.parent.realname*></strong>(<small><*$item.parent.pid*></small>)</p>
         <p>手机：<span title="mobile"><*if $item.parent.ischeck_mobile*><span class="label label-success">绑定</span><*else*><span class="label label-warning">未绑定</span><*/if*><*$item.parent.mobile*></span></p>
         <p>账号：<*if $item.parent.isinstalled*><span class="label label-info">已登录过</span><*else*><span class="label label-warning">还未登录</span><*/if*> <*$item.parent.username*> </p>
    </div>
    
    <div class="span7">
    <*foreach from=$item.student item=item1 key=key1 name=foo1*>
          <span <*if $item1.sex==1*>class="text-info"<*else*>class="text-error"<*/if*>><i class="icon-user"></i> <strong><*$item1.cnname*></strong> <small title="uid">(<*$item1.uid*>)</small></span>
          <span class="pull-right <*if $item1.sex==1*>text-info<*else*>text-error<*/if*>" >
          <small><*$item1.sexDisp*> <*if $item1.age*><span title="出生于 <*$item1.birthday*>"><i class="icon-time"></i> <*$item1.age*>岁</span><*/if*></small>
          &nbsp;&nbsp;<button class="btn btn-primary btn-small" onclick="deleteit(<*$item1.uid*>,<*$item.parent.mobile*>,'<*<*$item1.cnname*>*>')" >删除</button>
          &nbsp;&nbsp;<button class="btn btn-primary btn-small" <*if count($result)==1*>disabled<*/if*> onClick="movechild(<*$item1.uid*>,<*$item.parent.pid*>,'<*<*$item1.cnname*>*>')" >移动孩子至...</button>
          </span>
          <hr />
         
        <dl class="dl-horizontal clearfix">
           <*foreach from=$item1.class item=a key =k name=f*>
           <dt ><i class="icon-calendar"></i> <*$a.classname*></dt>
           <dd class="text-right clearfix"><small class="pull-right"><*$a.schoolname*><br />
          <*$a.groupname*></small>
          </dd>
           <*/foreach*>
         </dl>
          
        <*/foreach*>
        <div>
        
          </div>
          </div>
</div>
        </div>
        </li>
<*/foreach*>
</ul>
</div>
<*/if*>

<script type="text/javascript">
function movechild(uid,pid,child){
		$(document).ready(function(){
	 //  $(".addnew").click(function(){ // Click to only happen on announce links
		 $("#uid").val(uid);
		 $("#child").html(child);
  		 <*foreach from=$result item=item key=key name=foo*>
		 $("#parent<*$item.parent.pid*>").show();
        <*/foreach*>
		 
		 $("#parent"+pid).hide();
		 
		 $('#myModal').modal('show');
	  // });
	});
		

}
function selectradio(pid){
	$('#radio'+pid).attr('checked',true);
  		 <*foreach from=$result item=item key=key name=foo*>
		 	$("#parent<*$item.parent.pid*>").css("background-color","white");
        <*/foreach*>
		 $("#parent"+pid).css("background-color","#468847");
}

  function deleteit(uid,mobile,cnname)
{
  if(confirm("确定要删除吗？")){
   window.location='/<*$controller*>/indexdelete/uid/'+uid+'/mobile/'+mobile+'/cnname/'+cnname;
  }
} 

</script> 

<div id="myModal" class="modal hide fade" tabindex="-1" role="dialog" aria-labelledby="myModalLabel" aria-hidden="true">
      <form class="form-signin"action="/<*$controller*>/op" method="post">
  <div class="modal-header">
    <button type="button" class="close" data-dismiss="modal" aria-hidden="true">×</button>
    <h3 id="myModalLabel">正在移动 <span id="child" class="text-error"></span> 至其他的家长账号下</h3>
  </div>
  <div class="row">
  <div class="modal-body span5">
  	<table class="table table-hover table-condensed">
    <tr><th>家长</th><th>手机</th><th>账号</th><th>&nbsp;</th></tr>
  		 <*foreach from=$result item=item key=key name=foo*>
           <tr style="cursor:pointer" onClick="selectradio(<*$item.parent.pid*>)" id="parent<*$item.parent.pid*>"><td> <strong><i class="icon-home"></i> <*$item.parent.realname*></strong>(<small><*$item.parent.pid*></small>)</td>
           <td><small><span title="mobile"><*if $item.parent.ischeck_mobile*><span class="label label-success">绑定</span><*else*><span class="label label-warning">未绑</span><*/if*><*$item.parent.mobile*></span></small></td>
           <td><small><*if $item.parent.isinstalled*><span class="label label-info">已登录</span><*else*><span class="label label-warning">未登录</span><*/if*> <*$item.parent.username*></small></td><td><input type="radio" name="pid" value="<*$item.parent.pid*>" class="radio" id="radio<*$item.parent.pid*>"></td>
           </tr>
        <*/foreach*>
        </table>
        
  </div>
  </div>
  <div class="modal-footer">
    <button class="btn" data-dismiss="modal" aria-hidden="true">关闭</button>
    <button class="btn btn-primary" type="submit">保存设置</button>
    <input type="hidden" name="uid" value="" id="uid">
  </div>
        </form>
 </div>       

</div>




